﻿<common:LayoutAwarePage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:StudyTime_1"
    xmlns:common="using:StudyTime_1.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
    x:Name="pageRoot"
    x:Class="StudyTime_1.cardBuilder"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Mode=Self}}"
    IsTabStop="false"
    mc:Ignorable="d" Loaded="pageRoot_Loaded">
    <common:LayoutAwarePage.Resources>
        <Storyboard x:Name="cardBuilderStory">
            <PopInThemeAnimation  Storyboard.TargetName="addCard" FromHorizontalOffset="-1000"/>
            <PopInThemeAnimation  Storyboard.TargetName="saveAll" FromHorizontalOffset="-1000"/>
        </Storyboard>

    </common:LayoutAwarePage.Resources>

    <!--<Page.Resources>-->


    <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
    <!--<x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>-->

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}" Background="#FF259CFF">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="Card Builder" Style="{StaticResource PageHeaderTextStyle}"/>
        </Grid>
        <Grid Margin="10,0,0,0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" >
            <TextBox x:Name="question" HorizontalAlignment="Left" Height="52" Margin="299,176,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="644" IsSpellCheckEnabled="True"/>
            <TextBlock HorizontalAlignment="Left" Margin="153,176,0,0" TextWrapping="Wrap" Text="Question or Vocab Item" VerticalAlignment="Top" Height="52" Width="140"/>
            <TextBox x:Name="answer" HorizontalAlignment="Left" Height="311" Margin="299,279,0,0"  VerticalAlignment="Top" Width="644" AcceptsReturn="True" ManipulationMode="System" FontSize="12" TextWrapping="Wrap" IsSpellCheckEnabled="True"/>
            <TextBlock  HorizontalAlignment="Left" Margin="153,279,0,0" TextWrapping="Wrap" Text="Answer or Definition" VerticalAlignment="Top" Height="52" Width="140"/>
            <TextBlock HorizontalAlignment="Left" Height="57" Margin="299,103,0,0" TextWrapping="Wrap" Text="Create a Study Card" VerticalAlignment="Top" Width="644" TextAlignment="Center" FontFamily="Segoe UI" FontSize="20"/>
            <TextBlock x:Name="errorBox" HorizontalAlignment="Left" Height="77" Margin="898,-107,0,0" TextWrapping="Wrap"  VerticalAlignment="Top" Width="342" FontSize="18" Foreground="#FFF70808"/>
            <Button x:Name="addCard" Content="Add Card" HorizontalAlignment="Left" Height="75" Margin="2.5,383,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="addCard_Click" >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </Button.RenderTransform>

            </Button>
            <Button  x:Name="saveAll" Content="Save Deck" HorizontalAlignment="Left" Height="75" Margin="4,476,0,0" VerticalAlignment="Top" Width="237"  RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="saveAll_Click">
                <Button.RenderTransform>
                    <CompositeTransform SkewY="-20"/>
                </Button.RenderTransform>
            </Button>
            <Button x:Name="addImage" Content="Add Image" HorizontalAlignment="Left" Height="75" Margin="980,383,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="addImage_Click"  >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>

            </Button>
            <Button x:Name="loadDeck" Content="Open Deck" HorizontalAlignment="Left" Height="75" Margin="980,476,0,0" VerticalAlignment="Top" Width="237" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Click="loadDeck_Click"  >
                <Button.RenderTransform>
                    <CompositeTransform SkewY="20"/>
                </Button.RenderTransform>

            </Button>
            <!--<UI:AdControl ApplicationId="testclient" AdUnitId="ADPT44" HorizontalAlignment="Left" Height="150" Margin="0,10,0,0" VerticalAlignment="Top" Width="155"/>-->
        </Grid>

    </Grid>
</common:LayoutAwarePage>
